﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using RRTWSEntityDSD.Dominio;
using RRTWSNegocioDSD.Dao;
using RRTWSEntityDSD.Dao;
using System.ServiceModel.Web;
using System.Net;
using RRTWSDSD.ServiceEntidad;

namespace RRTWSEntityDSD.ServiceEntidad.WFCServiceREST
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "WCFPagosService" in code, svc and config file together.
    public class WCFPagosService : IWCFPagosService
    {

        private static PagoServices pagoService = new PagoServices();
        public static OperacionEnLineaDAO operacionEnLineaDAO = new OperacionEnLineaDAO();

        public Pago actualizarPagoEnEfectivo(OperacionLinea ope)
        {
            Pago p = pagoService.actualizarPagoEnEfectivo(ope.idOperacion);
            return p;
        }

        public OperacionLinea getOperacionModoEfectivo(string ticket)
        {
            if (string.IsNullOrEmpty(ticket))
                throw new WebFaultException<string>("El ticket no puede ser nulo o vacío", HttpStatusCode.InternalServerError);



            OperacionLinea op  = operacionEnLineaDAO.getOperacionEnLineaPorTicket(ticket);
            if (op == null)
                throw new WebFaultException<string>("No existe Operación con ticket: " + ticket, HttpStatusCode.InternalServerError);
            return op;

        }
    }
}
